package com.peace.hospital.feign.hospitalization.controller;

import com.peace.hospital.entity.hospitalization.entity.*;
import com.peace.hospital.entity.hospitalization.entity.dto.InpatientmessageDto;
import com.peace.hospital.entity.outpatientdept.Chargingitems;
import com.peace.hospital.entity.outpatientdept.Patientinformation;
import com.peace.hospital.entity.outpatientdept.dto.RegistrationEntryDto;
import com.peace.hospital.feign.hospitalization.service.HospitalizationService;
import com.peace.hospital.feign.outpatientdepartment.service.OutpatientDepatmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;

import java.sql.Date;

/**
 * 住院模块*/
@RestController
@RequestMapping("/book")
public class HospitalizationController {


        // 绑定变量名字和属性，参数封装进类
        @InitBinder("people")
        public void initBinderPeople(WebDataBinder binder) {
            binder.setFieldDefaultPrefix("people.");
        }

        // 绑定变量名字和属性，参数封装进类
        @InitBinder("staffinfo")
        public void initBinderStaffinfo(WebDataBinder binder) {
            binder.setFieldDefaultPrefix("staffinfo.");
        }

        // 绑定变量名字和属性，参数封装进类
        @InitBinder("doctoradvice")
        public void initBinderPatientinformation(WebDataBinder binder) {
            binder.setFieldDefaultPrefix("doctoradvice.");
        }

        // 绑定变量名字和属性，参数封装进类
        @InitBinder("department")
        public void initBinderDepartment(WebDataBinder binder) {
            binder.setFieldDefaultPrefix("department.");
        }

        // 绑定变量名字和属性，参数封装进类
        @InitBinder("position")
        public void initBinderPosition(WebDataBinder binder) {
            binder.setFieldDefaultPrefix("position.");
        }

    @Autowired
    private HospitalizationService hospitalizationService;

        /**
         * 添加挂号信息
         */
//
//        @RequestMapping(value = "/getdeparement",method = RequestMethod.GET)
//        public String allDepartment(){
//            return hospitalizationService.allDepartment();
//        }
//
//        @RequestMapping(value = "/displayStaffByDepartment",method = RequestMethod.GET)
//        public String selectStaff(@ModelAttribute("deparement") Department department, @ModelAttribute("position") Position position){
//            return hospitalizationService.selectStaff(department,position);
//        }
//
//        @RequestMapping(value = "/insertInpatientMessage",method = RequestMethod.GET)
//        public String insertInpatientMessage(
//                @ModelAttribute("people") People people, @ModelAttribute("inpatientmessage") Inpatientmessage inpatientmessage,
//                @ModelAttribute("staffinfo") Staffinfo staffinfo){
//            return hospitalizationService.insertInpatientMessage(people,inpatientmessage,staffinfo);
//        }
//
//        @RequestMapping(value = "/displayFullSckbed",method = RequestMethod.GET)
//        public String displayFullSckbed(@ModelAttribute("deparement") Department department){
//                    return hospitalizationService.displayFullSckbed(department);
//        }

        @RequestMapping(value = "/displayAll/{deptid}",method = RequestMethod.GET)
        public String displayAllInner(@PathVariable("deptid") Integer department){
            Department department1 = new Department();
            department1.setDepid(department);
            System.out.println(department);
            return hospitalizationService.displayAllInner(department1);
        }
//        @RequestMapping(value = "/updateOut",method = RequestMethod.POST)
//        public String updateOut(@ModelAttribute("inpatientmessage") Inpatientmessage inpatientmessage){
//            return hospitalizationService.updateOut(inpatientmessage);
//        }
//        @RequestMapping(value = "/displayOneMessage",method = RequestMethod.GET)
//        public String displayOneMessage(@ModelAttribute("inpatientmessage") Inpatientmessage inpatientmessage,
//                                 @ModelAttribute("people") People people,
//                                 @ModelAttribute("sckbed") Sckbed sckbed,
//                                 @ModelAttribute("satffinfo") Staffinfo staffinfo){
//            return hospitalizationService.displayOneMessage(inpatientmessage,people,sckbed,staffinfo);
//        }
//
//        @RequestMapping(value = "/updateNewMessage",method = RequestMethod.POST)
//        public String updateNewMessage(@ModelAttribute("inpatientmessage") Inpatientmessage inpatientmessage){
//            return hospitalizationService.updateNewMessage(inpatientmessage);
//        }
//
//        @RequestMapping(value = "/insertDoctorAdvice",method = RequestMethod.POST)
//        public String insertDoctorAdvice(@ModelAttribute("doctoradvice") Doctoradvice doctoradvice){
//            return hospitalizationService.insertDoctorAdvice(doctoradvice);
//        }
//
//        @RequestMapping(value = "/selectDoctorAdvice",method = RequestMethod.GET)
//        public String selectDoctorAdvice(@ModelAttribute("people") People people){
//            return hospitalizationService.selectDoctorAdvice(people);
//        }
//
//        @RequestMapping(value = "/deleteAdvice",method = RequestMethod.POST)
//        public String deleteAdvice(@ModelAttribute("doctoradvice") Doctoradvice doctoradvice){
//            return hospitalizationService.deleteAdvice(doctoradvice);
//        }
//
//        @RequestMapping(value = "displayDebts",method = RequestMethod.GET)
//        public String displayDebts(){
//            return hospitalizationService.displayDebts();
//        }
}
